<template>
	<a-select :placeholder="placeholder" :options="projectList" show-search allow-clear @change="handleChange" />
</template>

<script setup>
	import { ref, onMounted } from 'vue'
	import projectApi from '@/api/tjzy/project/projectApi'
	const emits = defineEmits(['change'])
	const props = defineProps({
		modelValue: [String],
		placeholder: {
			type: String,
			default: '请选择所属项目'
		}
	})
	const projectList = ref([])

	onMounted(() => {
		projectApi.listAllProject('', false).then((res) => {
			projectList.value = res
		})
	})
	const handleChange = (val) => {
		emits('change', val)
	}
</script>
